package writtenexamination.baorong;

/**
 * @author cyt
 * @create 2020-10-20 下午 4:01
 */
public class Ta {
    public static void main(String[] args) {
        Ta ta = new Ta();
        System.out.println(ta.get("aaaa", "bb"));
    }

    public int get(String a, String b) {
        int ans = -1;
        int lenb = b.length();
        for (int i = 0; i < a.length() - lenb; i++) {
            String substring = a.substring(i, lenb + i);
            if (substring.equals(b)) {
                ans = i;
                break;
            }
        }
        return ans;
    }

}
